<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>Insert title here</title>
		<link rel="stylesheet" href="../css/reg.css" type="text/css"></link>
		<script type="text/javascript"
			src="../js/jquery-validation-1.10.0/lib/jquery-1.7.2.js"></script>
		<script type="text/javascript">  
		function updateUser(state,id){
		
			$.ajax({
  			type: "POST",
   			url: "admin!updateUserState.action",
   			data: "id="+id+"&state="+state,
   			success:function(){
   				
   				if(state==0){
   				$("#td_"+id).html("正常");
   				$("#upbtn_"+id).replaceWith("<input id='upbtn_"+id+"' type='button' value='封停' onClick='updateUser(1,"+id+")'/>");
   				
   				}else{
   				$("#td_"+id).html("停用");
   				$("#upbtn_"+id).replaceWith("<input id='upbtn_"+id+"' type='button' value='恢复正常' onClick='updateUser(0,"+id+")'/>");
   				
   				}
   			}
			});
		
		}
		
		</script>
		<link rel="stylesheet" href="../css/Style.css" type="text/css"></link>
	</head>
	<body>
		<table width="980px" border="0" cellspacing="0" cellpadding="0"
			align="center">
			<tr>
				<td width="50%" height=80 rowspan=2>
					<div class=Mleft>

						<img src="../imgs/logo.gif" border=0>
					</div>
				</td>
				<td width="50%">
					<span id=AjaxShow></span>
					<br>
				</td>
			</tr>
			<tr>
				<td valign=bottom align=right>
					欢迎您：
					<strong><font color=red>沉黙de泠栤</font> </strong>
					<a href=/login.asp?Action=Logout target=_parent>退出</a>
				</td>
			</tr>
		</table>
		<table id=div border="0" cellspacing="0" cellpadding="0" align=center>
			<tr>
				<td>
					<img src=../imgs/center_top.gif>
				</td>
			</tr>
			<tr>
				<td
					style='padding: 5px; border-left: 1px #CCCCCC solid; border-right: 1px #CCCCCC solid'>
					<table border="0" cellspacing="0" cellpadding="0" align=center>
						<tr>
							<td width="155" valign=top>
								<jsp:include page="../frame/adminLeft.jsp" />
							</td>
							<td width="810" valign="top">
								<!-- right -->
								<div class="UserPath">
									您的位置：
									<a href="Index.asp">系统管理</a> &gt;
									<a href="User_ClassAD.asp?ChannelID=2">用户信息管理</a>
								</div>
								<form
									action="<%=path%>/changeGoods/changeGoods!deleteGoods.action"
									name="myform" method="POST">
									<table width="100%" cellpadding="2" cellspacing="0" border="0"
										align="center" class="td1">

										<tbody>
											<tr>
												<td class="td4" colspan="9">
													用户列表
												</td>
											</tr>
											<tr align="center" class="td3">
												<td>
													id
												</td>
												<td>
													用户名
												</td>
												<td width="15%">
													注册时间
												</td>
												<td width="15%">
													上次登录时间
												</td>
												<td width="15%">
													上次登录ip
												</td>
												<td width="10%">
													状态
												</td>
												<td width="10%">
													操作
												</td>
												
											</tr>
											<c:forEach items="${userList}" var="users">
												<tr align="center" class="td3">

													<td>
														${users.id }
													</td>
													<td>
														${users.userAccount }
													</td>
													<td width="15%">
													<fmt:formatDate value="${users.regeistDate }" type="both" />
														
													</td>
													<td width="15%">
														<fmt:formatDate value="${users.lastDate }" type="both" />
													</td>
													<td width="15%">
														${users.lastIp}
													</td>
													<td id="td_${users.id }" width="10%">

													<c:choose>
														<c:when test="${users.state==0}">
														正常
														</c:when>
														<c:when test="${users.state==1}">
														停用
														</c:when>
														</c:choose>
													</td>
													
													<td width="10%">
													<c:choose>
														<c:when test="${users.state==0}">
														<input id="upbtn_${users.id }" type="button" value="封停" onclick="updateUser(1,${users.id });"/>
														</c:when>
														<c:when test="${users.state==1}">
														<input id="upbtn_${users.id }" type="button" value="恢复正常" onclick="updateUser(0,${users.id });"/>
														</c:when>
														</c:choose>
														
													</td>

												</tr>
											</c:forEach>
										</tbody>
									</table>

								</form>
								<table width="100%" cellpadding="3" cellspacing="0"
									align="center" class="td1">
									<tbody>

									</tbody>
								</table>
								<!-- right end -->
							</td>

						</tr>

					</table>
				</td>
			</tr>
			<tr>
				<td>
					<img src="../imgs/center_bottom.gif">
				</td>
			</tr>
		</table>


	</body>
</html>
